package com.chenfan.mcn.model.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.chenfan.mcn.constant.NumberFormatCst;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 直播商品-Excel导入DTO
 * @author wulg
 * @date 2023/3/15
 */
@Data
public class LiveCommodityInputDTO implements Serializable {

    private static final long serialVersionUID = -5873685045098285338L;

    /**
     * 商品ID
     */
    @Excel(name = "商品ID")
    @NotBlank(message = "【商品ID】必填")
    @Size(max = 20, message = "【商品ID】长度不能超过{max}个字符")
    private String commodityId;

    /**
     * 商品名称
     */
    @Excel(name = "商品名称")
    @NotBlank(message = "【商品名称】必填")
    @Size(max = 50, message = "【商品名称】长度不能超过{max}个字符")
    private String commodityName;


    /**
     * 主播
     */
    @Excel(name = "主播")
    @NotNull(message = "【主播】必填")
    private String anchorName;

    /**
     * 直播时间
     */
    @Excel(name = "直播时间")
    @NotNull(message = "【直播时间】必填")
    @Pattern(regexp = "^[1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$", message = "【直播时间】格式错误，请参照模板示例")
    private String liveDateStr;

    /**
     * 直播平台
     */
    @Excel(name = "直播平台")
    @NotBlank(message = "【直播平台】必填")
    private String livePlatformName;

    /**
     * 佣金比例
     */
    @Excel(name = "佣金比例", numFormat = NumberFormatCst.PERCENT)
    @NotNull(message = "【佣金比例】必填")
    @DecimalMin(value = "0.00")
    @Digits(integer = 10, fraction = 2, message = "【佣金比例】数值必须大于等于0，其中整数位最多{integer}位，小数位最多{fraction}位")
    private BigDecimal commissionRate;

    /**
     * 销售数量
     */
    @Excel(name = "销售数量")
    @NotNull(message = "【销售数量】必填")
    @DecimalMin(value = "0")
    @Digits(integer = 10, fraction = 0, message = "【销售数量】数值必须大于等于0且小于等于{integer}位的整数")
    private BigDecimal saleQty;

    /**
     * 成交单价
     */
    @Excel(name = "成交单价")
    @NotNull(message = "【成交单价】必填")
    @DecimalMin(value = "0.00")
    @Digits(integer = 10, fraction = 2, message = "【成交单价】数值必须大于等于0，其中整数位最多{integer}位，小数位最多{fraction}位")
    private BigDecimal transactedPrice;

    /**
     * 成交金额
     */
    @Excel(name = "成交金额")
    @NotNull(message = "【成交金额】必填")
    @DecimalMin(value = "0.00")
    @Digits(integer = 10, fraction = 2, message = "【成交金额】数值必须大于等于0，其中整数位最多{integer}位，小数位最多{fraction}位")
    private BigDecimal transactedAmount;

    /**
     * 结算金额
     */
    @Excel(name = "结算金额")
    @NotNull(message = "【结算金额】必填")
    @DecimalMin(value = "0.00")
    @Digits(integer = 10, fraction = 2, message = "【结算金额】数值必须大于等于0，其中整数位最多{integer}位，小数位最多{fraction}位")
    private BigDecimal settlementAmount;

    /**
     * 结算佣金
     */
    @Excel(name = "结算佣金")
    @NotNull(message = "【结算佣金】必填")
    @DecimalMin(value = "0.00")
    @Digits(integer = 10, fraction = 2, message = "【结算佣金】数值必须大于等于0，其中整数位最多{integer}位，小数位最多{fraction}位")
    private BigDecimal settlementCommission;

    /**
     * 备注
     */
    @Excel(name = "备注")
    @Size(max = 300, message = "【备注】长度不能超过{max}个字符")
    private String remark;
}
